// 角色管理相关接口
import request from '@/utils/request'
// 接口
import type { IMenuResponseData, IMenuFormData } from './type'
import type { ResponseData } from '@/types/common'

enum API {
  MENU_LIST_API = '/admin/acl/permission',
  MENU_ADD_URL = '/admin/acl/permission/save',
  MENU_EDIT_URL = '/admin/acl/permission/update',
  MENU_DEL_URL = '/admin/acl/permission/remove',
}

// 菜单列表
export const reqMenuList = () => {
  return request.get<any, IMenuResponseData>(API.MENU_LIST_API)
}

// 新增菜单
export const reqMenuAdd = (data: IMenuFormData) => {
  return request.post<any, ResponseData>(API.MENU_ADD_URL, data)
}

// 修改菜单
export const reqMenuEdit = (data: IMenuFormData) => {
  return request.post<any, ResponseData>(API.MENU_EDIT_URL, data)
}

// 删除菜单
export const reqMenuDel = (id: number) => {
  return request.delete<any, ResponseData>(API.MENU_DEL_URL + `/${id}`)
}
